package BookSystem.operation;

import BookSystem.book.BookList;

import java.util.Scanner;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 */
public class FindOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("请输入书名: ");
        Scanner in = new Scanner(System.in);
        String name = in.nextLine();
        int currentSize = bookList.getUseSize();
        for (int i = 0; i < currentSize; i++) {
            if (name.equals(bookList.getBook(i).getName())){
                System.out.println(bookList.getBook(i));
                return;
            }
        }
        System.out.println("未找到该图书！");
    }
}
